<template>
  <div class="call">
    <h1>消息</h1>
    <div class="box1">
      <div><img :src="count[29]" alt="" class="imgEs1" /></div>
      <div><img :src="count[30]" alt="" class="imgEs2" /></div>
      <div><img :src="count[31]" alt="" class="imgEs3" /></div>
    </div>
    <div class="box2">
      <div class="box2-top" v-for="item in counts" :key="item.title">
        <div class="top-now"><img :src="item.touxiang" alt="" /></div>
        <div class="top-two">
          <p class="font_now">{{ item.title }}</p>
          <p class="font_two">{{ item.content }}</p>
          <p class="font_three"></p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { computed, onMounted, watch } from "@vue/runtime-core";
import { useStore } from "vuex";
export default {
  setup() {
    const store = useStore();
    onMounted(() => {
      store.dispatch("geticon");
      store.dispatch("getnews");
    });
    const count = computed(() => {
      return store.state.iconlist;
    });
    const counts = computed(() => {
      return store.state.newslist;
    });

    watch(count, (o, n) => {
      n;
      console.log(count);
    });
    watch(counts, (o, n) => {
      n;
      console.log(counts);
    });
    return {
      count,
      counts,
    };
  },
};
</script>
<style lang="less" scoped>
.call {
  overflow: hidden;
  overflow-y: auto;
  width: 375px;
  height: 100vh;
  background-image: repeating-radial-gradient(
    circle at 30% 20%,
    rgb(183, 238, 252) 0%,
    #fafbfa 30%,
    #fafbfa 100%
  );

  > h1 {
    margin-top: 10px;
    font-size: 14px;
    text-align: center;
  }

  .box1 {
    display: flex;
    margin: auto;
    margin-top: 20px;
    width: 357px;
    height: 101px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 1px 1px 1px #a1bdc4;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 18px;

    > div {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 63px;
      height: 63px;
      border-radius: 50%;

      > img {
        border-radius: 50%;
        width: 40px;
        height: 40px;
        margin-left: 0;
      }

      .imgEs2 {
        background-image: linear-gradient(to right, #fd684f, #f28e26);
      }

      .imgEs3 {
        background-image: linear-gradient(to right, #98e05f, #0de3ac);
      }
    }

    :nth-child(1) {
      background-image: linear-gradient(to right, #30c0f5, #00e3fe);
    }

    :nth-child(2) {
      background-image: linear-gradient(to right, #fd684f, #f28e26);
    }

    :nth-child(3) {
      background-image: linear-gradient(to right, #98e05f, #0de3ac);
    }
  }

  .box2 {
    padding-top: 15px;
    margin: auto;
    width: 357px;
    padding-bottom: 8px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 1px 1px 1px #a1bdc4;

    .box2-top {
      display: flex;
      margin-bottom: 18px;
      margin-left: 18px;
      margin-right: 10px;
      justify-content: space-between;

      .top-now {
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: #92e9ff;

        > img {
          width: 100%;
          height: 100%;
          border-radius: 50%;
        }
      }

      .top-two {
        margin-left: 8px;

        .font_now {
          margin-top: 5px;
          font-size: 15px;
          font-weight: 900;
          margin-bottom: 11px;
        }

        .font_two {
          font-size: 10px;
          color: #909090;
        }

        .font_three {
          margin-top: 13px;
          width: 267px;
          height: 1px;
          background: #909090;
        }
      }
    }
  }
}
</style>
